/*
write by wuweiwei
Wing.js is write by wweiwei
*/
(function(win){
	var $ID = function(id){
		return document.getElementById(id);
	}
	/*
	Wing is global object
	*/
	var wRouter = Wing.wRouter;

	var wR = new wRouter({
		useHistory:false,
		refresh:function(hash){
		}
	}); /*路由控制器组件*/
	
	wR.loadScript('/jsfile/App.js',function(){
		console.log("loaded");
	});
	
	var routerCfg = {
		container:document.getElementById("app"),
		routes:[
			{
				url:"/index",
				controller:"Index",
				templateUrl:"tpls/index.html", /*载入模板到container指定的DOM里*/
				js:"/jsfile/App.Index.js"
			},
			{
				url:"/project/:id",
				controller:"project",
				templateUrl:"/tpls/project.html",
				js:"/jsfile/App.Project.js"
			},
			{
				url:"/microService/service",
				servicePath:"/microService/js/serviceConfig.js",
				templateUrl:"/microService/service.html"
			}
		],
		otherwise:{
			//redirectTo:"/index"
		}
	}

	wR.config(routerCfg);
	wR.controller("Index",function(args){
		App.Index.init(args);
		console.log(this.location);/* this is location object*/
	});
	wR.controller("project",function(args){
		/*
		args is url :id object
		this args is "{id:2017111231}"
		*/
		App.Project.init(args);
	});
	//wR.triggerRouter("Index");
})(window);
